Skip to content

Initial positions are set to 0 causing sudden movement#67

Open
daniel-kovari wants to merge 4 commits into
enactic:mainfrom
Kovari-Industries:main
Open

Initial positions are set to 0 causing sudden movement#67
daniel-kovari wants to merge 4 commits into
enactic:mainfrom
Kovari-Industries:main

Conversation

@daniel-kovari
Copy link
Copy Markdown

@daniel-kovari daniel-kovari commented Nov 8, 2025

Fixes #66

@daniel-kovari daniel-kovari changed the title Initial positions are set to 0 causing sudden movement #66 Initial positions are set to 0 causing sudden movement Nov 8, 2025
@kou kou requested a review from thomasonzhou November 10, 2025 08:02
@euyniy
Copy link
Copy Markdown
Contributor

euyniy commented Nov 19, 2025

Will test on the hardware!! Thanks

Copy link
Copy Markdown

@ggorjup ggorjup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this on real hardware and it seems to work fine.

In case it's useful, I'm suggesting a couple of simplifications.

Comment thread openarm_hardware/src/v10_simple_hardware.cpp Outdated
Comment thread openarm_hardware/src/v10_simple_hardware.cpp Outdated
Comment thread openarm_hardware/src/v10_hardware.cpp Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work!
Could v10_hardware.cpp go into a separate PR? This looks unrelated to the zero-position issue.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I cleaned up the PR. I moved the changes for gravity compensation onto another feature branch: https://github.com/Kovari-Industries/openarm_ros2/tree/feat/gravity-compensation. It is using a KDL chain and implying the urdf from the controller manager - HardwareInfo::original_xml. This works for me and makes the controls much smoother. If this is a valid implementation, I can put that up as a separate PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for splitting that out. It's much cleaner to review now.

Gravity compensation is something we're interested in as well, so please feel free to open it as a separate PR.
We can discuss the design (KDL chain, reading URDF via HardwareInfo::original_xml, etc.) over there.

"Setting current position...");

// Use read() to populate state arrays
read(rclcpp::Time(), rclcpp::Duration(0, 0));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if CAN communication fails? Won't pos_states_ be left holding a stale or default value after read()?
Would it make sense to add a safety check?

XYZ-WONO added a commit to XYZ-WONO/openarm_ros2 that referenced this pull request May 13, 2026
on_activate()에서 return_to_zero() 대신 set_current_pose()를 호출하여
활성화 시 현재 위치를 커맨드 초기값으로 설정함

기존 return_to_zero():
- 모든 관절을 position=0.0 으로 MIT 제어
- 어떤 자세에 있든 활성화 순간 0 rad로 강제 이동 → 갑작스럽고 위험한 움직임

수정 set_current_pose():
- read()로 현재 모터 상태를 읽음
- 현재 위치를 커맨드 초기값으로 설정 (pos_commands_[i] = pos_states_[i])
- 활성화 순간 움직임 없음 → 이후 trajectory 명령부터 부드럽게 시작

참고: enactic#67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Initial positions are set to 0 causing sudden movement

4 participants